home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / a_to_d / delftips / ti2804.asc < prev    next >
Text File  |  1996-09-15  |  1KB  |  61 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2804
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  May 31, 1995                             PAGE  :  1/1
  11.  
  12.     TITLE  :  Undo in a Memo field
  13.  
  14.  
  15.  
  16.  
  17. Doing an UnDo in a Memo Field:
  18.  
  19.   If you have a pop-up menu in a TMemo, and put shortcuts 
  20. on it for the Cut,Copy, Paste, then you can handle those 
  21. events, and call CuttoClipBoard, CopytoClipBoard, etc.
  22.  
  23.   However, if you put an Undo option onto your pop-up menu 
  24. (normally Ctrl-Z) how do you instruct the TMemo to do the Undo?
  25. If the built-in undo is sufficient, you can get it easier than
  26. a Ctrl+Z:
  27.  
  28.     Memo1.Perform(EM_UNDO, 0, 0);
  29.  
  30.  To check whether undo is available so as to enable/disable 
  31. an undo menu item:
  32.  
  33.     Undo1.Enabled := Memo1.Perform(EM_CANUNDO, 0, 0) <> 0;
  34.  
  35.                
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. DISCLAIMER: You have the right to use this technical information
  58. subject to the terms of the No-Nonsense License Statement that
  59. you received with the Borland product to which this information
  60. pertains.
  61.